import React from 'react'
import {gql, useLazyQuery} from '@apollo/client';

const AccountListGql = gql`
    query AccountList { # 定义查询方法(浏览器上显示的)
        accountList { # 定义与后端对接的方法名
            id
            username
            password
        }
    }
`;

export const Page3: React.FC = () => {
    const [getAccount, {loading, data}] = useLazyQuery(AccountListGql);
    if (loading) return null;
    console.log(data, '请求回来的数据');
    return (
        <div>
            点击按钮请求数据
            <button onClick={() => getAccount()}>点击按钮</button>
        </div>
    )
}
